import type { BaseResponse } from '@/utils/request';
import { request } from '@/utils/request';

export function updateAccountInfo(data: any) {
  return request<BaseResponse<any>>({
    url: 'account/update',
    method: 'post',
    data,
  });
}

export function updatePassword(data: any) {
  return request({
    url: 'account/password',
    method: 'post',
    data,
  });
}

export function getInfo() {
  return request<API.AdminUserInfo>({
    url: '/manage/admin/user/detail',
    method: 'get',
  });
}

export function permmenu() {
  return request<API.PermMenu>(
    {
      url: '/manage/admin/menu/listMenu',
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function updatePwd(data: any) {
  return request({
    url: '/manage/admin/user/updatePwd',
    method: 'put',
    data,
  });
}

export function logout() {
  return request({
    url: '/manage/admin/user/logout',
    method: 'post',
  });
}

export function getDictory(configType: string) {
  return request({
    url: `/manage/admin/dataDictionary/list/${configType}`,
    method: 'get',
  });
}

export function organizerList(params) {
  return request(
    {
      url: '/manage/admin/task/kyxfjc/organizerList',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function bindFileUrl(fileUrl: any) {
  return request({
    url: `/manage/upload/bindFileUrl?fileUrl=${fileUrl}`,
    method: 'get',
  });
}

export function getAreaList() {
  return request({
    url: `/manage/common/getAreaList`,
    method: 'get',
  });
}

export function downloadFile(fileUrl: any) {
  return request(
    {
      url: `/manage/upload/downloadFile?fileUrl=${fileUrl}`,
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function docProduct(data: any) {
  return request(
    {
      url: `/manage/admin/task/xfjdjc/docProduct`,
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function getDeptList() {
  return request({
    url: `/manage/admin/dept/getDeptList`,
    method: 'get',
  });
}

export function getUserList(deptId: any, userType: any) {
  return request({
    url: `/manage/admin/user/getUserList/${deptId}/${userType}`,
    method: 'get',
  });
}

export function delDoc(type: any, taskId: any) {
  return request(
    {
      url: `/manage/admin/task/xfjdjc/delDoc/${type}/${taskId}`,
      method: 'get',
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function createPenalty(data: any) {
  return request(
    {
      url: `/manage/admin/case/generatePenaltyWrittenDecision`,
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function uploadCaseFile(data: any) {
  return request(
    {
      url: `/manage/admin/case/uploadCaseFile`,
      method: 'put',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function uploadLicenseFile(data: any) {
  return request(
    {
      url: `/manage/admin/task/kyxfjc/process`,
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function deleteCaseFile(caseFileId: any) {
  return request(
    {
      url: `/manage/admin/case/deleteCaseFile/${caseFileId}`,
      method: 'delete',
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function deleteUploadCaseFile(caseFileId: any) {
  return request(
    {
      url: `/manage/admin/case/deleteUploadCaseFile/${caseFileId}`,
      method: 'delete',
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function createNotice(data: any) {
  return request(
    {
      url: `/manage/admin/case/generateInvestNotice`,
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function createWritten(data: any) {
  return request(
    {
      url: `/manage/admin/case/generatePenaltyWrittenNotice`,
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

export function createAdvice(data: any) {
  return request(
    {
      url: `/manage/admin/case/generateAskAdviceNote`,
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}
